package com.example.democlient.network.serverpackets;

import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;

import com.example.democlient.model.Task;
import com.example.democlient.network.ServerConnection;
import com.example.democlient.network.packet.ServerPacket;

/**
 * 向服务器发送
 * @author Administrator
 *
 */
public class SM_ROAD_DESIGN_REQUEST extends ServerPacket
{

	//private final String account;
	//private final double xaxis;
	//private final double yaxis;
	private int listSize;
	private Task[] taskArray;
	private int disSize;
	public List<Integer> list = new ArrayList<Integer>();
	
	public SM_ROAD_DESIGN_REQUEST(int listSize,Task[] taskArray,List<Integer> disList)
	{
		super(0x12);
		this.listSize=listSize;
		this.taskArray = taskArray;
		this.list = disList;
		this.disSize = disList.size();
	}

	@Override
	protected void writeImpl(ServerConnection con, ByteBuffer buf)
	{
		writeD(buf,listSize);
		for(int i=0;i<taskArray.length;i++){
			Task temp = taskArray[i];
			writeD(buf,temp.getId());
			writeDF(buf,temp.getXaxis());
			writeDF(buf,temp.getYaxis());
		}
		writeD(buf,disSize);
		for(int i=0;i<list.size();i++){
			writeD(buf,list.get(i));
		}
	}
}
